
********************************************************************************
*
* GRIST TO THE MILL OF SUBVERSION:
* STRIKES AND COUPS IN COUNTERINSURGENCIES
*
* By Christian Glaessel, Belén González, Adam Scharpf
*
* European Journal of International Relations
*
* April 2020
*
********************************************************************************
*
* Content:	Replication of Figure 2 in manuscript	
*
*			Steps:
*			1) Set working directory
*			2) Run do-file to replicate Figure 2
*
********************************************************************************

	version 15.1
	set more off

	clear all
  
 
 
********************************************************************************
*
* Setting working directory in macro
*
********************************************************************************

	*Insert path to folder containing dataset "StrikesCoups_Figure2.dta" before running
	global path="..." //Example: "C:\Users\me\Desktop\Glaesseletal_StrikesCoups"
 
 
 
********************************************************************************
*
* Producing log-file of results
*
********************************************************************************

	*Starting log file
	log using "$path\Glaesseletal_StrikesCoups_EJIR_figure2", replace 

	
	
********************************************************************************
*
* Loading replication dataset
*
********************************************************************************

	*Loading replication dataset
	use "$path\StrikesCoups_Figure2.dta"


	
********************************************************************************
*
* Descriptive statistics
*
********************************************************************************

	****************************************************************************
	*Figure 2. Temporal order of resistance events and coup attempts
	****************************************************************************
	
	#delimit ;
	twoway lowess perc bin if precoup==1, color(black) lwidth(*1.5) lpattern(solid)
		|| lowess perc bin if postcoup==1, color(black) lwidth(*1.5) lpattern(shortdash)
		by(var
			, 
			imargin(l+4 b+4)
			legend(off)  
			graphregion(fcolor(white) lcolor(white)) note("")
			)
		subtitle(, lcolor(black) fcolor(gs14) size(*1.5) margin(t=1.25))
		ysize(1) xsize(2.5)
		xline(-.5, lwidth(*10) lcolor(black%20) lpattern(solid))
		yscale(range(0 30) noline)
		xscale(range(-10 9) noline titlegap(*+10)) 
		ytitle("Events in % (smoothed)", size(large))
		xtitle("	 Weeks", size(large))
		yticks(0(2)30, tlength(*0.5))
		ylabel(0(10)30, angle(0) nogrid labsize(vlarge))
		xticks(-10(1)9, tlength(*.5))
		xlabel(-10 -5 -.5 "0" 4 "5" 9 "10", labsize(vlarge))
		 ttext(28.5 3.3 "Coup day", placement(w) size(large) color(black))
		plotregion(lcolor(black)) graphregion(color(white) lcolor(white) lalign(outside)) 
		;
	#delimit cr
	graph export "$path\figure2.pdf", as(pdf) replace
	
	

********************************************************************************	
*	
********************************************************************************		
	
	*Closing graph windows
	graph close _all 
	
	*Clearing data
	clear all
	
	*End recording log file
	log close		
